package person;

public class Demo02 {
    private int age;

    public void setAge(int age) {
        if (age >= 0 && age <=120) {
            System.out.println("年龄不合法");
        }
        else
            this.age = age;

        }

        public static void main(String[] args) {
            Demo02 n = new Demo02();
            n.setAge(50);
        }
    }

